<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" href="../../../../static/mobile/default/css/layout.css" />
    <link rel="icon" type="image/png" href="../../../../static/favicon.ico" />
     <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
    <script src="../../../../static/js/jquery/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
        <script src="../../../../static/js/jquery/jquery.cookie.js"></script>
    <script src="../../../../static/mobile/default/js/page.js"></script>
    

    <title>产品 - 达漂亮</title>

    <link rel="stylesheet" href="../../../../static/mobile/default/js/Swiper-4.0.7/swiper.min.css" />
    <link rel="stylesheet" href="../../../../static/mobile/default/css/goods.css" />


</head>

<body>
    <div class="page Goods">
        <div class="page-hd">
            <div class="header">
                <div class="header-left back">
                    <a href="javascript:history.go(-1)" class="left-arrow"></a>
                </div>
                <div class="header-title">
                    <span class="fs32 color_9 active">商品</span>
                    <span class="fs32 color_9">详情</span>
                </div>
            </div>
        </div>

        <div class="page-bd tabBox" id="goods">
            <!-- 页面内容-->
            <!-- 商品轮播 -->
            <div class="swiperBox">
                <div class="swiper-container swiper1" id="swiper01">
                    <div class="swiper-wrapper">

                    </div>
                    <div class="swiper-pagination pagination1"></div>

                </div>
                <div class="timeBox text_box hide" id="prom_box">
                    <p class="fs28 color_w fw_b" id="prom_status_text">--</p>
                    <div class="time start">
                        <p class="fs28 color_w" id="prom_time_text">--</p>
                        <div>00</div><span>:</span>
                        <div>00</div><span>:</span>
                        <div>00</div>
                    </div>
                </div>
            </div>
            <!-- 商品信息 -->
            <div class="moneyBox">
                <div class="money_shou">
                    <div class="top">
                        <div class="color_3 fs30 num money">
                            <p class="fw_b fm_p">权益价：￥</p>
                            <em class="fs52  retail_price"></em>
                        </div>
                        <span class="fs22 color_w BGcolor_r hide" id="is_prom_price">活动价</span>
                    </div>
                    <!-- 浮按钮 -->
                    <div class="floatBtn">
                        <a href="" class="share "><img
                                src="../../../../static/mobile/default/images/goodsIcon01_2.png" alt=""></a>
                        <div class="attention "><img src="../../../../static/mobile/default/images/goodsIcon01_3.png"
                                data-no="0" alt=""></div>
                    </div>
                </div>
                <div class="original fs24 color_9 ">￥<span class="market_price"></span></div>
                <div class="name fw_b fs34 color_3 good_name" style="margin-bottom: 10px;"></div>
                <div class="tips fs28 color_9 goCoupons">
                    <div style="display: flex;"><span  class="sell-num"></span>
                        <p class="hide">运费10元</p>
                    </div>
                    <div class="goCouponsBtn" style="display: none;"><span class="fs28 fw_b color_3">领券</span><img
                            src="../../../../static/mobile/default/images/rightIcon.png" alt="" class="threeRight">
                    </div>
                </div>
            </div>
            <!-- 店铺 -->
            <div class="shopName bor_b" style="display: none">
                <div><img src="../../../../static/mobile/default/images/shoplogo.png" alt=""><span
                        class="fs32 fw_b color_3">xxxx</span>
                </div>
                <img src="http://www.mjyx9999.com/static/mobile/default/images/rightIcon.png" alt="" class="threeRight">
            </div>
            <!-- 评论 -->
            <div class="comment ">
            </div>
            <!-- 图文 -->
            <div class="imgText">
                <div class="title fw_b fs32 color_3">商品详情</div>
                <p class="goods_infor">

                </p>
            </div>

        </div>

        <!-- 弹出规格选择 -->
        <div class="model modelSize">
            <div class="modelContent">
                <div class="closeBox"><img src="../../../../static/mobile/default/images/close_icon.png" alt=""></div>
                <div class="top">
                    <div class="left"><img id="skuImg" src="../../../../upload/gimg/2020/10/5f86a4d445b12_thumb.png"
                            alt=""></div>
                    <div class="right">
                        <div class="money">
                            <div class="color_3 fs30 num">
                                <p class="fw_b fm_p">￥</p>
                                <div class="skuPrice">
                                    <em class="fs52 retail_price"></em>
                                </div>
                            </div>
                            <span class="fs22 color_w BGcolor_r is_promote hide" id="is_prom_price_sku">活动价</span>
                        </div>
                        <div class="fs24 color_9 moneyPrimary">￥<span class="market_price"></span></div>
                    </div>
                </div>
                <div class="tan_text fs24 color_r fw_b" style="display: none;">对不起！该规格不参与优惠！</div>
                <div class="cantre sku_list">

                    <div class="block">
                        <div class="numberBox">
                            <p class="fs32 fw_b color_3">数量</p>
                            <div class="number">
                                <img src="../../../../static/mobile/default/images/goodsIcon05.png" alt=""
                                    class="minus onj">
                                <input class="fs30 color_3 pr_selnum" type="text" value="1" id="buynumber"
                                    name="buynumber" onkeyup="this.value=this.value.replace(/\D/g,'')"
                                    onafterpaste="this.value=this.value.replace(/\D/g,'')">
                                <img src="../../../../static/mobile/default/images/goodsIcon06.png" alt=""
                                    class="add onz">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="buttBox">
                    <span class="fs28 fw_b color_w BGcolor_3 buyBtn" data-goods_id="" data-type="cart">加入购物车</span>
                    <span class="fs28 fw_b color_w BGcolor_r buyBtn" data-goods_id="" data-type="other">立即购买</span>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            var  goodsImgUrl = ''
            var goods_brief = ''
            var sub_goods = [];
            var skuCstom = [];
            var skuImgs = [];
            //选择商品数量
            $(".onj").click(function () {
                act = parseInt($(".pr_selnum").val());
                if (act <= 1) {
                    $(".pr_selnum").val(1);
                } else {
                    $(".pr_selnum").val(act - 1);
                }
            })
            $(".onz").click(function () {
                act = parseInt($(".pr_selnum").val());
                $(".pr_selnum").val(act + 1);
            })
            $(".pr_selnum").blur(function () {
                if ($(this).val() == "" || $(this).val() == "0") { $(this).val(1); }
                act = parseInt($(".pr_selnum").val());
            });
            function selsku() {
                if (sub_goods.length < 1) return false;
                var sku = [];
                $('.sku_list .tag_active').each(function () {
                    var skukey = $(this).data('skukey');
                    sku.push(skukey);
                });
                var _sku = sku.join(":");
                $('.buyBtn').data('sku', _sku);
                var skuName = new Array();
                $.each(sku, function (k, v) {
                    skuName.push(skuCstom[v]);
                })
                $('#skuImg').attr('src', skuImgs[_sku]);
                var buynumber = $('#buynumber').val();
                $('.selSkuName').html(skuName.join(" - "));

                // if (sub_goods[_sku].is_promote == 1){
                //     $('.is_promote').removeClass('hide');
                // }else{
                //     $('.is_promote').addClass('hide');
                // }

                $('.skuPrice').find('em').html(sub_goods[_sku].exp_price[0]);
                $('.skuPrice').find('p').html('.' + sub_goods[_sku].exp_price[1]);
                $('.moneyPrimary').html('￥' + sub_goods[_sku].market_price);

                initActivity();
                //$('.kcnum').html(sub_goods[sku].goods_number);
            }

            $(function () {
           share()
     function  share(){
    /***用户点击分享到微信圈后加载接口接口*******/
        var url=window.location.href ;
        //  url = url+ '&promoterId='+ $.cookie('myID')
        console.log("url:"+url);
            $.ajax({
		    url: "/api/mp/wxconfig",
		    type: "post",
		    data:{shareUrl:url},
		    headers:{ token: $.cookie('code')},
		    dataType: "json",
		    success: function(data){
		        $.cookie('appId',JSON.stringify(data.data))
		        weixinShare(data.data,{
		            title:$('.good_name').text(),
		            link:url,
		            desc: goods_brief,
		            imgUrl:goodsImgUrl,
		        })
		    },
		    error: function() {
// 			    _alert('ajax request failed!!!!');
			    return;
		    } 
        })
	    
	    
	    }      

                //开启规格选择弹窗
                $('.size').on('click', function () {
                    $('.modelSize').show();
                    selsku();
                })
                //规格选择
                $('.sku_list span').on('click', function () {
                    $(this).addClass('tag_active')
                    $(this).siblings().removeClass('tag_active');
                    selsku();
                })
                //关闭规格选择弹窗
                $('.closeBox').on('click', function () {
                    $('.model').hide()
                })
            })
        </script>

        <!-- 弹出领取优惠券 -->
        <link rel="stylesheet" href="../../../../static/mobile/default/css/coupons.css" />
        <div class="model getCoupons" style="display: none;">
            <div class="modelContent">
                <div class="title fs36 fw_b color_3">请领取优惠券</div>
                <div class="list bonusList">
                </div>
                <div class="closeBtn fs32 fw_b color_w BGcolor_r" onclick="closeModel(this)">关闭</div>
            </div>
        </div>
        <script type="text/html" id="TabTpl">
    <div class="tabBox">
        <div class="tabBlock ">
            <div class="listBox">
                
                {{each list as item index}}
                <div class="block {{if item.receive_status==0}}userTicket{{/if}}" data-type_id="{{item.type_id}}">
                    <div class="left">
                        <div class="fs34 fw_b">{{item.type_name}}</div>
                        <p class="fs26">满{{item.min_amount}}元可用</p>
                        <span class="fs24">{{item._use_start_date}}-{{item._use_end_date}}</span>
                    </div>
                    <div class="right">
                        <div class="fs38 money">
                            <p class="fw_b">￥</p><em class="fs60 num">{{item.type_money}}</em>
                        </div>
                        {{if item.receive_status==0}}<button class="fs24 active receive_do">立即领取</button>{{/if}}
                        {{if item.receive_status==1}}<button class="fs24  noNum">已领取</button>{{/if}}
                        {{if item.receive_status==2}}<button class="fs24  noNum">已抢光</button>{{/if}}
                    </div>
                </div>
                {{/each}}
                
            </div>
        </div>
    </div>
</script>
        <script>


            var goods_id = getUrlParam("goodsId");
            $('.share').attr('href','../../mycode/goods_id/goodsShare.html?goods_id='+goods_id)
            $('.buyBtn').attr('data-goods_id', goods_id)
            //请求列表数据
            //获取商品详细信息
            function getGoodsInfo() {
                $.ajax({
                    url: 'https://mp.jianguoes.com/api/mp/detailGoods',// 跳转到 action
                    data: { goodsId: goods_id,promoterId:getUrlParam('promoterId')?getUrlParam('promoterId'):getUrlParam('PID')?getUrlParam('PID'):null},
                    type: 'get',
                    headers: { 'token': $.cookie('code') },
                    dataType: 'json',
                    success: function (res) {
                        console.log(res);
                        if (res.errno != 0) {
                            _alert(res.errmsg);
                            $('.get_list_tip').html('加载失败，点击重新加载.');
                            return false;
                        }
                        var concent = ''
                        for (let index = 0; index < res.data.gallery.length; index++) {
                            concent += ` <a href="javascript:;" class="swiper-slide"><img
                                src="`+ res.data.gallery[index].img_url + `" alt="" /></a>`

                        }
                        goodsImgUrl = res.data.info.list_pic_url
                        goods_brief = res.data.info.goods_brief
                        $('.swiper-wrapper').html(concent)
                        $('#skuImg').attr('src', res.data.info.list_pic_url)
                        $('.retail_price').text(res.data.info.retail_price)
                        $('.market_price').text(res.data.info.source_price)
                        $('.good_name').text(res.data.info.name)
                        $('.goods_infor').html(res.data.info.goods_desc)
                        $('.sell-num').text('热销'+res.data.info.sell_volume)
                        if (res.data.userHasCollect == '1') {
                        $('.attention').find('img').attr('src', '/static/mobile/default/images/goodsIcon01_3_lh.png')
                        $('.attention').find('img').data('no', '1')
                    } else {
                        $('.attention').find('img').attr('src', '/static/mobile/default/images/goodsIcon01_3.png')
                        $('.attention').find('img').data('no', '0')
                    }

                        swiper1 = createSwiper(1);

                    }, error: function () {
                        $('.get_list_tip').html('加载失败，点击重新加载.');
                    }
                });
            }

            function getList() {
                $('.bonusList').append('<div class="get_list_tip">加载数据中...</div>');
                $.ajax({
                    url: '/shop/api.bonus/getbonuslistreceivable.html',// 跳转到 action
                    data: { goods_type: 1, goods_id: goods_id },
                    type: 'post',
                    cache: false,
                    headers: { 'token': $.cookie('code') },
                    dataType: 'json',
                    success: function (res) {
                        console.log(res);
                        if (res.code == 0) {
                            _alert(res.errmsg);
                            $('.get_list_tip').html('加载失败，点击重新加载.');
                            return false;
                        }
                        $('.get_list_tip').remove();
                        if (res.list.length > 0) {
                            $(".goCouponsBtn").show();
                            $('.bonusList').append(template('TabTpl', res));
                            $('.bonusList').append('<div class="loadEnd">—— 没有更多啦，我是有底线的 ——</div>');
                        } else {
                            $(".goCouponsBtn").hide();
                        }
                    }, error: function () {
                        $('.get_list_tip').html('加载失败，点击重新加载.');
                    }
                });
            }
            getList();//执行加载
            getGoodsInfo();
            $(function () {
                $(".goCouponsBtn").click(function (obj) {
                    $('.getCoupons').show();
                })
                /*立即领券*/
                $(".bonusList").on('click', '.receive_do', function () {
                    var _this = $(this);
                    var type_id = _this.parents('.block').data('type_id');
                    var arr = new Object();
                    arr.id = type_id;
                    jq_ajax('/shop/api.bonus/receivefree.html', arr, function (res) {
                        if (res.code == 0) {
                            _alert(res.errmsg);
                        } else if (res.code == 2) {
                            _alert('抱歉，优惠券已抢光！');
                            _this.text('已抢光');
                            _this.parents('.block').removeClass('userTicket');
                        } else {
                            _this.text('已领取');
                            _this.parents('.block').removeClass('userTicket');
                        }
                    })
                });
            })
            function getUrlParam(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
                var r = window.location.search.substr(1).match(reg);  //匹配目标参数
                if (r != null) return unescape(r[2]); return null; //返回参数值
            }
        </script>

        <!-- 底部 -->
        <div class="page-ft">
            <div class="left">
                <a href="../../../../index.html"><img src="../../../../static/mobile/default/images/bottom_icon01.png"
                        alt=""><span class="fs22 color_6">首页</span></a>
                <!--<div v5_href><img src="../../static/mobile/default/images/goodsIcon02.png" alt=""><span class="fs22 color_6" >客服</span>
        </div>-->
                <a href="../../../flow/cart.html"><em class="BGcolor_r fs22 color_w cartNum">0</em><img
                        src="../../../../static/mobile/default/images/bottom_icon04.png" alt=""><span
                        class="fs22 color_6">购物车</span></a>
            </div>
            <div class="right">
                <div class="fs28 color_w fw_b BGcolor_3 buyBtn" data-type="show">加入购物车</div>
                <div class="fs28 color_w fw_b BGcolor_r butt buyBtn" data-type="show"> <span
                        class="fs28 color_w fw_b buy_m">立即购买</span></div>
            </div>
            <input type="hidden" name="goods_id" value="124">
            <input type="hidden" name="sku_id" value="">
            <input type="hidden" name="prom_type" id="prom_type" value="">
            <input type="hidden" name="prom_id" id="prom_id" value="">
        </div>

    </div>

    <script src="../../../../static/js/art-template.js"></script>
    <script src="../../../../static/mobile/default/js/lib/fastclick.js"></script>
    <script src="../../../../static/js/jquery/lazyload/jquery.lazyload.js"></script>
    <script>
        $(function () {
            FastClick.attach(document.body);
            $("img.lazy").lazyload({ effect: "fadeIn", event: "scroll", container: $(".page-bd") });
        });
    </script>

    <script src="../../../../static/mobile/default/js/Swiper-4.0.7/swiper.min.js"></script>
    <script>
        $(function () {

            initActivity();

            // 关注
            $('.attention').on('click', function () {
                var imgObj = $(this).find('img');
                var status = imgObj.data('no');
                jq_ajax('https://mp.jianguoes.com/api/mp/addorDelCollect', {goodsId:goods_id}, function (res) {
                    if (res.errno != 0) {
                        _alert(res.errmsg);
                        return false;
                    }
                    if (res.data.type != 'delete') {
                        imgObj.attr('src', '/static/mobile/default/images/goodsIcon01_3_lh.png')
                        imgObj.data('no', '1')
                    } else {
                        imgObj.attr('src', '/static/mobile/default/images/goodsIcon01_3.png')
                        imgObj.data('no', '0')
                    }
                },'get');
            })
            jq_ajax('/shop/api.comment/getlistbygoods/goods_id/124/limit/1.html', '', function (res) {
                if (res.code == 0) {
                    return false;
                }
                if (res.data.total_count > 0) { 
                    $('.commentBox').removeClass('hide');
                }
                $('.commentNum').html('(' + res.data.total_count + ')');
                if (res.data.total_count > 0) {
                    $('.commentBox .user img').attr('src', res.data.list[0].headimgurl ? res.data.list[0].headimgurl : '/static/mobile/default/images/defheadimg.jpg');
                    $('.commentBox .user .uname').html(res.data.list[0].user_name);
                    $('.commentBox .user .time').html(res.data.list[0]._time);
                    $('.commentBox  .content').html(res.data.list[0].content);
                    $.each(res.data.list[0].imgs, function (i, v) {
                        $('.commentBox .comimg').append('<img src="' + v.thumbnail + '.html">');
                    })
                }
            })

            // 滚动出现tab
            $('#goods').scroll(function () {
                var scrolltop = $(this).scrollTop()
                // console.log($('.comment').offset().top,scrolltop)
                if (scrolltop > 100) {
                    $('.header-title').css('display', 'flex');
                    $('.header-left').removeClass('back')
                    $('.page-hd').css('background-color', '#fff')
                    $('.header').addClass('bgShow');
                    if ($('.comment').offset().top < $('.page-hd').height()) {
                        $('.header-title span').eq(1).addClass('active')
                        $('.header-title span').eq(1).siblings().removeClass('active')
                        if ($('.imgText').offset().top < $('.page-hd').height()) {
                            $('.header-title span').eq(2).addClass('active')
                            $('.header-title span').eq(2).siblings().removeClass('active')
                        } else {
                            $('.header-title span').eq(1).addClass('active')
                            $('.header-title span').eq(1).siblings().removeClass('active')
                        }
                    } else {
                        $('.header-title span').eq(0).addClass('active')
                        $('.header-title span').eq(0).siblings().removeClass('active')
                    }

                } else {
                    $('.header-title').css('display', 'none');
                    $('.header-left').addClass('back')
                    $('.page-hd').css('background-color', 'transparent')
                    $('.header').removeClass('bgShow')
                }

            })
            //tab切换
            $('.header-title span').on('click', function () {
                var index = $(this).index()
                var topHeight = $('.page-hd').height()
                var commentTop = $('.comment').offset().top + $('#goods').scrollTop() - topHeight + 1
                var imgTextTop = $('.imgText').offset().top + $('#goods').scrollTop() - topHeight + 1
                if (index == 0) {
                    $("#goods").animate({ scrollTop: 0 }, 300)
                } else if (index == 1) {
                    $("#goods").animate({ scrollTop: commentTop + 'px' }, 300)
                } else {
                    $("#goods").animate({ scrollTop: imgTextTop + 'px' }, 300)
                }
            })
            //点击购买按钮
            $('.buyBtn ').on('click', function () {
                var obj = $(this);
                if (obj.data('type') == 'show') {
                    $('.modelSize').show();
                    selsku();
                } else {
                    addToCart(obj);
                }
            })
        })
        //获取购物车
        jq_ajax("https://mp.jianguoes.com/api/mp/getCart", '', function (res) {
            if (res.code == 0) return false;
            $('.cartNum').html(res.cartTotal.goodsCount);
        }, 'get');
        //添加到购物车
        function addToCart(obj) {
            var arr = new Object;
            arr.goodsId = obj.data('goods_id');
            arr.specifications = obj.data('sku');
            if (typeof (arr.specifications) != 'undefined') {
                arr.sku_id = sub_goods[arr.specifications].sku_id;
            }
            arr.type = obj.data('type');
            arr.number = $('#buynumber').val();
            arr.prom_type = $('#prom_type').val();
            arr.prom_id = $('#prom_id').val();
            if(arr.type == 'other'){
                 jq_ajax("https://mp.jianguoes.com/api/mp/buyGoods", arr, function (res){
                    console.log(res)
                if (res.errno == 0) {
                window.location.href = '../../../flow/checkout.html?type=other'
               return
                }
             if (res.errmsg) _alert(res.errmsg);
  
             }, 'get');
            }else{
               jq_ajax("https://mp.jianguoes.com/api/mp/addCart", arr, function (res){
                if (res.errno == 0) {
                $('.cartNum').html(res.data.cartTotal.goodsCount);
                $('.modelSize').hide();
                $('#buynumber').val('1')
                _alert('添加购物车成功');
                return
                }
               if (res.errmsg) _alert(res.errmsg);
  
             }, 'get'); 
            }

           
            
        }

        function createSwiper(index) {
            var swiper = new Swiper(".swiper" + index, {
                pagination: {
                    el: ".pagination" + index
                },
                paginationClickable: true,
                observer: true,
                observeParents: true,
                loop: true,
                autoplay: {
                    delay: 4000,
                    stopOnLastSlide: false,
                    disableOnInteraction: false
                },
                onSlideChangeEnd: function (swiper) {
                    swiper.update(); //swiper更新
                }
            });
            return swiper;
        }
        function closeModel(obj) {
            $(obj).parents('.model').hide()
        }

        /**
         * 初始化商品活动
         */
        function initActivity() {
            var arr = new Object;
            arr.goods_id = $('input[name=goods_id]').val();
            var sku = [];
            $('.sku_list .tag_active').each(function () {
                var skukey = $(this).data('skukey');
                sku.push(skukey);
            });
            if (sku.length > 0) {
                var _sku = sku.join(":");
                console.log(_sku);
                arr.sku_id = sub_goods[_sku].sku_id;
            }
            //获取相关活动
            jq_ajax("/shop/api.goods/checkactivity.html", arr, function (res) {
                if (res.code == 1) {
                    console.log(res);
                    activityTheme(res.data);
                }
            });
        }
        //活动相关显示
        function activityTheme(data) {

            if (data.activity_is_on == 1) {
                if (data.status == 1) {
                    $('#prom_box').css('background', '#f65236');
                    $('#prom_status_text').text('限时优惠中');
                    $('#prom_time_text').text('距结束');

                    if (data.goods.stock <= 0) {
                        $('#prom_box').css('background', '#333333');
                        $('#prom_status_text').text('该商品活动库存已售罄');
                        buyBTnTheme(data, 0);
                    }

                    if (data.goods.is_spec == 1) {
                        if (data.goods_info) {
                            if (data.goods_info.goods_number < 0)
                                $(".tan_text").text("该规格活动库存已售罄，您将以原价购买！");
                            $(".tan_text").show();
                            buyBTnTheme(data, 0);
                        }
                    }

                } else if (data.status == 0) {
                    $('#prom_box').css('background', '#36b12a');
                    $('#prom_status_text').text('限时优惠即将开始');
                    $('#prom_time_text').text('距开始');
                }

                $("#is_prom_price").text('活动价').removeClass('hide');
                if (data.goods_info) {
                    $("#is_prom_price_sku").text('活动价').removeClass('hide');
                    $(".tan_text").hide();

                    $('.skuPrice').find('em').html(data.goods_info.exp_price[0]);
                    $('.skuPrice').find('p').html('.' + data.goods_info.exp_price[1]);
                    $('.moneyPrimary').html('￥' + data.goods_info.market_price);

                    buyBTnTheme(data, 1);
                } else {
                    $("#is_prom_price_sku").text('').addClass('hide');
                    $(".tan_text").text("该规格不参与优惠！")
                    $(".tan_text").show();
                    buyBTnTheme(data, 0);
                }

                if (data.goods.is_spec == 1) {
                    var html = '<p class="fw_b fm_p">￥</p><em class="fs52">' + data.goods.exp_min_price[0] + '</em><p>.' + data.goods.exp_min_price[1] + '</p><em class="fs52">~</em><em class="fs52">' + data.goods.exp_max_price[0] + '</em><p>.' + data.goods.exp_max_price[1] + '</p>';
                } else {
                    var html = '<p class="fw_b fm_p">￥</p><em class="fs52">' + data.goods.exp_min_price[0] + '</em><p>.' + data.goods.exp_min_price[1] + '</p>';
                }
                $('.moneyBox .money').html(html);

                $('#prom_box').removeClass('hide');//显示优惠活动
                codeButton($('.time div'), data.diff_time, data.status);//倒计时
            } else {
                $('#prom_box').addClass('hide');
                $("#is_prom_price").text('').addClass('hide');
                $("#is_prom_price_sku").text('').addClass('hide');
                buyBTnTheme(data, 0);
            }
        }
        //购买按钮显示
        function buyBTnTheme(data, status) {
            if (status == 0) {
                $('#prom_type').val(0);
                $('#prom_id').val(0);
                $('.butt ').html('<span class="fs28 color_w fw_b buy_m">立即购买</span>');
            } else {
                $('#prom_type').val(data.prom_type);
                $('#prom_id').val(data.prom_id);
                var goods_price = data.goods_info.goods_price * 1;
                var shop_price = data.goods_info.market_price * 1;
                var html = '<span class="fs28 color_w fw_b buy_m">购买￥' + goods_price + '</span>';
                html += '<span><del class="fs24 color_f o_5">￥' + shop_price + '</del></span>';
                $('.butt ').html(html);
            }
        }

        //活动倒计时
        function codeButton(obj, time, status) {
            var code = obj;
            var time = parseInt(time) //总秒数
            var hour = time % 3600 == 0 ? parseInt(time / 3600) - 1 : parseInt(time / 3600); //shi
            var min = time % 60 == 0 ? parseInt((time - hour * 3600) / 60) - 1 : parseInt(time / 3600) > 0 ? parseInt((time - hour * 3600) / 60) : parseInt(time / 60); //fen
            var second = time % 60 == 0 ? 59 : time % 60 //miao
            code.eq(0).text(hour > 9 ? hour : '0' + hour)
            code.eq(1).text(min > 9 ? min : '0' + min)
            code.eq(2).text(second > 9 ? second : '0' + second)
            set = setInterval(function () {
                code.eq(0).text(hour > 9 ? hour : '0' + hour)
                code.eq(1).text(min > 9 ? min : '0' + min)
                code.eq(2).text(--second > 9 ? second : '0' + second);
                if (hour <= 0 && min <= 0 && second <= 0) {
                    var prom_type = $('#prom_type').val();
                    if (prom_type == 1 && status == 1) {
                        $('#prom_box').css('background', '#333333');
                        $('#prom_status_text').text('限时优惠已结束');
                    } else if (prom_type == 1 && status == 0) {
                        initActivity();
                    }
                }
                if (second == 0) {
                    second = 60
                    min < 0 ? 0 : --min
                    if (min == 0 && hour > 0) {
                        min = 59
                        hour <= 0 ? 0 : --hour
                    }
                }
            }, 1000);
            setTimeout(function () {
                clearInterval(set);
            }, 1000 * time);
        }


    </script>

    <div class="alertBox">
        <div class="alertBG"></div>
        <div class="alert">
            <div class="text fs30 color_3 bor_b">

            </div>
            <!-- 单按钮 -->
            <div class="button fs32 fw_b color_r">
                知道了
            </div>
            <!-- 双按钮 -->
            <div class="buttonBox fs32 fw_b">
                <span class="color_9 bor_r cancel">取消</span>
                <span class="color_r confirm">确定</span>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        var is_xcx = 0;
        $(document).on('click', 'a', function () {
            var href = $(this).attr('href');
            if (href.indexOf('/pages') != -1) {
                if (is_xcx == 1) {
                    wx.miniProgram.navigateTo({
                        url: href
                    })
                    return false;
                } else {
                    return false;
                }
            }
        })
    </script>
</body>

</html>